package cn.jinzhu.sleuth;

import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class HelloService {
    private static final Log log= LogFactory.getLog(HelloController.class);
    @Autowired
    RestTemplate restTemplate;
    @Async

    public String hello(){
        log.info("service hello");
        return restTemplate.getForObject("http://localhost:8080/hello",String.class);
    }
    @Scheduled(cron = "0/10 * * * * ?")
    public String hello1(){
        log.info("service hello");
        return restTemplate.getForObject("http://localhost:8080/hello",String.class);
    }
}
